// 音乐数据库
const musicData = [
  {
    id: 1,
    title: '多幸运',
    singer: '菟菟彩',
    src: '/pages/sing/多幸运.mp3',
    coverImgUrl: '/pages/images/c1.jpg',
    category: 'popular',
    tags: ['流行', '治愈']
  },
  {
    id: 2,
    title: '安娜的橱窗',
    singer: '封茗囧菌',
    src: '/pages/sing/安娜的橱窗.mp3',
    coverImgUrl: '/pages/images/c2.jpg',
    category: 'popular',
    tags: ['流行', '古风']
  },
  {
    id: 3,
    title: '夜航星',
    singer: '不才',
    src: '/pages/sing/夜航星.mp3',
    coverImgUrl: '/pages/images/c3.jpg',
    category: 'popular',
    tags: ['古风', '民谣']
  },
  {
    id: 4,
    title: '坏女孩',
    singer: '安腾',
    src: '/pages/sing/坏女孩.mp3',
    coverImgUrl: '/pages/images/c4.jpg',
    category: 'popular',
    tags: ['流行', '热门']
  }
];

// 轮播图数据
const banners = [
 
  {
    id: 2,
    imageUrl: '/pages/images/banner2.jpg',
    title: '新歌速递',
    type: 'playlist',
    targetId: 2
  },
  {
    id: 3,
    imageUrl: '/pages/images/banner3.jpg',
    title: '精选歌单',
    type: 'playlist',
    targetId: 3
  }
];

// 推荐电台数据
const radios = [
  { id: 1, name: '五杀超神燃曲', cover: '/pages/images/1.jpg' },
  { id: 2, name: '想起初恋', cover: '/pages/images/3.jpg' },
  { id: 3, name: '静听古风优美歌曲', cover: '/pages/images/2.jpg' },
  { id: 4, name: '成为不了你喜欢的样子', cover: '/pages/images/4.jpg' },
  { id: 5, name: '一人一首代表曲', cover: '/pages/images/5.jpg' },
  { id: 6, name: '难平的不是山海，是你', cover: '/pages/images/6.jpg' }
];

// 获取所有音乐
function getAllMusic() {
  return musicData;
}

// 搜索音乐
function searchMusic(keyword) {
  if (!keyword) {
    return musicData;
  }
  keyword = keyword.toLowerCase();
  return musicData.filter(music => 
    music.title.toLowerCase().includes(keyword) ||
    music.singer.toLowerCase().includes(keyword) ||
    music.tags.some(tag => tag.toLowerCase().includes(keyword))
  );
}

// 根据ID获取音乐
function getMusicById(id) {
  return musicData.find(music => music.id === id);
}

// 获取轮播图
function getBanners() {
  return banners;
}

// 获取推荐电台
function getRadios() {
  return radios;
}

module.exports = {
  getAllMusic,
  searchMusic,
  getMusicById,
  getBanners,
  getRadios
};

